/**
 * This class is used to test create new assessment.
 */
package com.tcc.assessment.facultyrole;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import com.tcc.nav.logic.NavFinder;
import com.tcc.qa.test.util.AssertCheck;
import com.tcc.qa.test.util.BaseTest;
import com.tcc.qa.test.util.ButtonFinder;
import com.tcc.qa.test.util.InputFinder;
import com.tcc.qa.test.util.LinkFinder;
import com.tcc.qa.test.util.SelectFinder;
import com.tcc.qa.test.util.SwitchTo;


/**
 * @company CampusCruiser
 * @author Emily_Wang
 * @date 2012-6-18
 */
public class NewAssessment extends BaseTest{
	@BeforeTest


  @Test(description = "Navigate to the New Assessment page.", priority = 1)
  public void navigateToQCategory() {
    NavFinder.gotoTabPage(getWebDriver(), "Academics");
    LinkFinder.getLinkByText(getWebDriver(), "1-EmilySection-2012 summer-CampusLevel-Course").click();
    NavFinder.gotoMenuOptionPage(getWebDriver(), "Assessments Editor");
    LinkFinder.getLinkByText(getWebDriver(), "Assessments").click();
  }
	@Test(description = "Create new assessment.",priority=2)
	public void newAssessment(){
		ButtonFinder.getButtonById(getWebDriver(), "a_newAssessment").click();
		ButtonFinder.getInputButtonByValue(getWebDriver(), "Ok").click();
		ButtonFinder.getInputButtonByValue(getWebDriver(), "Cancel").click();
		AssertCheck.assertAlert(getWebDriver(), "Title: Please enter a title");//Check alert when title is null.
		SwitchTo.switchToAlert(getWebDriver()).accept();
		InputFinder.getInputById(getWebDriver(), "title").sendKeys("Emily's Assessment");
		ButtonFinder.getInputButtonByValue(getWebDriver(), "  Ok    ").click();
	}
	@Test(description = "Create new assessment.",priority=3)
	public void addContent_FromLib(){
		ButtonFinder.getButtonById(getWebDriver(), "ccQToolId").click();
		LinkFinder.getLinkByText(getWebDriver(), "Import From Library").click();
		SwitchTo.getWindowHandle(getWebDriver());
		ButtonFinder.getButtonById(getWebDriver(), "searchText").sendKeys("Emily");//enter title
		ButtonFinder.getSubmitButtonByValue(getWebDriver(), "Search").click();//click search
		InputFinder.getInputByName(getWebDriver(), "points").sendKeys("");//enter points
		/*choose format*/
		//LinkFinder.link("fmt_0"); selenium function.
		//(getWebDriver(), "fmt_0").click();
		LinkFinder.getLinkByText(getWebDriver(), "Header");
		LinkFinder.getLinkByText(getWebDriver(), "Short Answer");
		LinkFinder.getLinkByText(getWebDriver(), "Essay");
		LinkFinder.getLinkByText(getWebDriver(), "Fill in the blank");
		LinkFinder.getLinkByText(getWebDriver(), "Multiple Choice (Choose One)");
		LinkFinder.getLinkByText(getWebDriver(), "Multiple Choice (Choose Any)");
		LinkFinder.getLinkByText(getWebDriver(), "Yes / No");
		LinkFinder.getLinkByText(getWebDriver(), "True / False");
		LinkFinder.getLinkByText(getWebDriver(), "Matching One");
		LinkFinder.getLinkByText(getWebDriver(), "Matching Any");
		LinkFinder.getLinkByText(getWebDriver(), "Ordering");
		LinkFinder.getLinkByText(getWebDriver(), "Calculate");
		/*Choose Difficulty*/
		LinkFinder.getLinkByText(getWebDriver(), "Very Difficult");
		LinkFinder.getLinkByText(getWebDriver(), "Difficult");
		LinkFinder.getLinkByText(getWebDriver(), "Neither Difficult nor Easy");
		LinkFinder.getLinkByText(getWebDriver(), "Somewhat Easy");
		LinkFinder.getLinkByText(getWebDriver(), "Easy");
	
		/*Choose Category and other category*/
		SelectFinder.getSelectOption(getWebDriver(), "categories", "Emily").click();
		ButtonFinder.getButtonByTitle(getWebDriver(), "Add").click();
		ButtonFinder.getButtonById(getWebDriver(), "otherCategory").sendKeys("Emily");
		AssertCheck.assertAlert(getWebDriver(), "Entry already available.  Please choose another name.");
		SwitchTo.switchToAlert(getWebDriver()).accept();
		ButtonFinder.getButtonById(getWebDriver(), "otherCategory").sendKeys("Emily_Category");
		LinkFinder.getLinkByText(getWebDriver(), "Private Questions Only").click();
	

	}
	@Test
	public void addContent_FromFile(){
		
	}
	@Test
	public void addContent_AutoPick(){
		
	}
	@Test
	public void addContent_Button_NewPage(){
		
	}
	@Test
	public void addContent_Button_FromLib(){
		
	}
	@Test
	public void addContent_Button_FromFile(){
		
	}
	@Test
	public void addContent_Button_AutoPick(){
		
	}
	@AfterTest
	public void tearDown(){
		getWebDriver().quit();
	}
}
